package com.cup.bddm.config;

import java.util.Properties;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

public class Config extends PropertyPlaceholderConfigurer {
	// 总公司机构号
	public static final String CUP_INS_ID = "00010000";

	private static Properties props = null;

	@Override
	protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws BeansException {
		Config.props = props;
		super.processProperties(beanFactoryToProcess, props);
	}

	public static String get(String key) {
		return props.getProperty(key);
	}

	public static String get(String key, String defaultVal) {
		String val = get(key);
		return val == null ? defaultVal : val;
	}

	public static boolean getBoolean(String key, boolean defaultVal) {
		return "true".equalsIgnoreCase(get(key, "false"));
	}
}
